USB mass storage device access control method and access control apparatus

ABSTRACT

A USB mass storage device access control method and access control apparatus, a terminal device, and a computer readable storage medium. The access control method includes: in response to detecting that a USB mass storage device is inserted into a macOS, completing matching between an application and the USB mass storage device; controlling the macOS to release an access control permission for the USB mass storage device; and controlling the application to obtain the access control permission for the USB mass storage device. The solution can solve the problem in the prior art that an application cannot be controlled to implement, on a macOS, access control over a USB mass storage device.

CROSS-REFERENCE TO RELATED APPLICATIONS

The present disclosure is a continuation-application of International(PCT) Patent Application No. PCT/CN2018/104961 filed on Sep. 11, 2018,which claims a foreign priority of Chinese Patent Application No.201810456826.7, with the title of “USB MASS STORAGE DEVICE ACCESSCONTROL METHOD AND ACCESS CONTROL APPARATUS”, filed on May 14, 2018, theentire contents of which are hereby incorporated by reference in theirentireties.

TECHNICAL FIELD

The present disclosure belongs to the technical field of safe storage,and in particular, to a USB mass storage device access control method,an access control apparatus, a terminal device, and a computer readablestorage medium.

BACKGROUND

Universal serial bus mass storage devices (USB mass storage devices)generally refer to U-disks, mobile hardware disks, secure digital memorycards (SD cards), and so on, which are connected to computers throughUSB interfaces. The prior art generally controls applications toimplement access control for USB mass storage devices in Windowsoperating systems. However, macOS is an operating system run in theApple Macintosh computer series. Because of the particularity of macOS,access control permissions of USB mass storage devices inserted in macOSare locked by macOS, and therefore unable to control applications toimplement access control for USB mass storage devices in macOS. Forexample, if a USB mass storage device is a fingerprint U-disk, when auser of macOS uses a new fingerprint U-disk, it is required to firstcomplete operations such as fingerprint recording, modification,deletion, and so on in a Windows system, such that the fingerprintU-disk can be used in macOS, while it is unable to complete operationssuch as fingerprint recording, modification, deletion, and so on inmacOS.

Therefore, a new technical solution to solve the above technical problemis required.

SUMMARY OF THE DISCLOSURE

In view of this, the present disclosure provides a USB mass storagedevice access control method, an access control apparatus, a terminaldevice, and a computer readable storage medium, so as to solve theproblem in the prior art that an application cannot be controlled toimplement, on a macOS, access control over a USB mass storage device.

A first aspect of the present disclosure provides a USB mass storagedevice access control method, wherein the access control methodcomprises: in response to detecting that a USB mass storage device isinserted into a macOS, completing matching between an application andthe USB mass storage device; controlling the macOS to release an accesscontrol permission for the USB mass storage device; and controlling theapplication to obtain the access control permission for the USB massstorage device.

A second aspect of the present disclosure provides a terminal devicecomprising a memory and a processor coupled with the memory, wherein thememory is configured to store a computer program being executable in theprocessor, and the processor is configured to execute the computerprogram to implement a USB mass storage device access control methodaccording to the above first aspect.

A third aspect of the present disclosure provides a computer readablestorage medium, wherein the computer readable storage medium stores acomputer program, and the computer program, when being executed by aprocessor, implements a USB mass storage device access control methodaccording to the above first aspect.

Compared with the prior art, advantageous effect of the presentdisclosure is that: in the present disclosure, when it is detected thata USB mass storage device is inserted into a macOS, matching between anapplication and the USB mass storage device is completed; the macOS iscontrolled to release an access control permission for the USB massstorage device; and the application is controlled to obtain the accesscontrol permission for the USB mass storage device. In the presentdisclosure, by controlling the macOS to release an access controlpermission for the USB mass storage device, and enabling the applicationto obtain the access control permission for the USB mass storage device,the application can thus be controlled to implement access control forthe USB mass storage device on the macOS, while it is not required tofirst perform access control in a Windows system, so that access controlefficiency for the USB mass storage device is improved.

BRIEF DESCRIPTION OF THE DRAWINGS

In order to describe technical solutions of embodiments of the presentdisclosure more clearly, drawings required being used in description ofthe embodiments and the prior art will be simply introduced below.Obviously, the drawings in the following description are merely someembodiments of the present disclosure. For one of ordinary skill in theart, it is also possible to obtain other drawings according to thesedrawings without paying any creative work.

FIG. 1 is a schematic view of an implementing flow of a USB mass storagedevice access control method provided by a first embodiment of thepresent disclosure.

FIG. 2 is a schematic view of an implementing flow of a USB mass storagedevice access control method provided by a second embodiment of thepresent disclosure.

FIG. 3 is a schematic view of a USB mass storage device access controldevice provided by a third embodiment of the present disclosure.

FIG. 4 is a schematic view of a terminal device provided by a fourthembodiment of the present disclosure.

DETAILED DESCRIPTION

In the following description, for the purpose of illustration ratherthan limitation, specific details such as a specific system structureand technology are proposed for thorough understanding of theembodiments of the present disclosure. However, it should be clear tothose skilled in the art that the present disclosure can also beimplemented in other embodiments without these specific details. Inother cases, detailed descriptions of well-known systems, devices,circuits, and methods are omitted so as to avoid unnecessary detailsfrom obstructing the description of the present disclosure.

It should be understood that the term “comprising”, when being used inthis specification and appended claims, indicates the existence of thedescribed features, wholes, steps, operations, elements and/orcomponents, but does not exclude the existence or addition of one ormore other features, wholes, steps, operations, elements, componentsand/or collection thereof.

It should also be understood that the terms used in this specificationof the present disclosure are only for the purpose of describingspecific embodiments and are not intended to limit the presentdisclosure. As used in the specification and the appended claims of thepresent disclosure, unless the context clearly indicates otherwise, thesingular forms “a”, “an” and “the” are intended to include plural forms.

It should be further understood that the term “and/or” used in thespecification and appended claims of the present disclosure refers toany combination and all possible combinations of one or more of theassociated listed items, and includes these combinations.

As used in this specification and the appended claims, the term “if” canbe interpreted as “when” or “once” or “in response to determination” or“in response to detection” depending on the context. Similarly, thephrase “if determining” or “if detecting [described conditions orevents]” can be interpreted as meaning “once determining” or “inresponse to determination” or “once detecting [described conditions orevents]” or “in response to detection of [described conditions orevents]” depending on the context.

It should be understood that the value of the sequence number of eachstep in this embodiment does not mean the order of execution. Theexecution sequence of each process should be determined according to itsfunction and internal logic, and should not constitute any limitation tothe implementation process of the embodiment of the present disclosure.

According to a first aspect of the present disclosure, a USB massstorage device access control method is provided, wherein the accesscontrol method comprises: in response to detecting that a USB massstorage device is inserted into a macOS, completing matching between anapplication and the USB mass storage device; controlling the macOS torelease an access control permission for the USB mass storage device;and controlling the application to obtain the access control permissionfor the USB mass storage device.

In some embodiments, after the controlling the macOS to release anaccess control permission for the USB mass storage device, the methodfurther comprises: performing disconnection and USB bus reset for theUSB mass storage device.

In some embodiments, the in response to detecting that a USB massstorage device is inserted into a macOS, completing matching between anapplication and the USB mass storage device comprises: in response todetecting that a USB mass storage device is inserted into a macOS,sending, by the application, a descriptor information acquisitioncommand including a first special field to the USB mass storage device;and in response to detecting receiving descriptor information includinga second special field, completing matching between the application andthe USB mass storage device; wherein, the descriptor informationincluding a second special field refers to information returned by theUSB mass storage device after receiving the descriptor informationacquisition command including a first special field.

In some embodiments, the in response to detecting receiving descriptorinformation including a second special field, completing matchingbetween the application and the USB mass storage device comprises: inresponse to receiving, by the USB mass storage device, the descriptorinformation acquisition command including a first special field,returning, by the USB mass storage device, description information ofthe USB mass storage device to the application, wherein the descriptioninformation includes the second special field; and in response toreceiving, by the application, the descriptor information including asecond special field, completing matching between the application andthe USB mass storage device.

In some embodiments, before the controlling the macOS to release anaccess control permission for the USB mass storage device, the methodfurther comprises: by amending the second special field, indicating theUSB mass storage device as a non-USB mass storage device to the macOS.

In some embodiments, wherein the first special field differs from thesecond special field.

In some embodiments, the controlling the application to obtain theaccess control permission for the USB mass storage device comprises:controlling the application to perform access control for the USB massstorage device through a bulk-only transport command.

According to a second aspect of the present disclosure, a terminaldevice is provided, wherein the terminal device comprises a memory and aprocessor coupled with the memory, wherein the memory is configured tostore a computer program being executable in the processor, and theprocessor is configured to execute the computer program to implement aUSB mass storage device access control method comprising: in response todetecting that a USB mass storage device is inserted into a macOS,completing matching between an application and the USB mass storagedevice; controlling the macOS to release an access control permissionfor the USB mass storage device; and controlling the application toobtain the access control permission for the USB mass storage device.

In some embodiments, the in response to detecting that a USB massstorage device is inserted into a macOS, completing matching between anapplication and the USB mass storage device comprises: in response todetecting that a USB mass storage device is inserted into a macOS,sending, by the application, a descriptor information acquisitioncommand including a first special field to the USB mass storage device;and in response to detecting receiving descriptor information includinga second special field, completing matching between the application andthe USB mass storage device; wherein, the descriptor informationincluding a second special field refers to information returned by theUSB mass storage device after receiving the descriptor informationacquisition command including a first special field.

In some embodiments, the in response to detecting receiving descriptorinformation including a second special field, completing matchingbetween the application and the USB mass storage device comprises: inresponse to receiving, by the USB mass storage device, the descriptorinformation acquisition command including a first special field,returning, by the USB mass storage device, description information ofthe USB mass storage device to the application, wherein the descriptioninformation includes the second special field; and in response toreceiving, by the application, the descriptor information including asecond special field, completing matching between the application andthe USB mass storage device.

In some embodiments, before the controlling the macOS to release anaccess control permission for the USB mass storage device, the methodfurther comprises: by amending the second special field, indicating theUSB mass storage device as a non-USB mass storage device to the macOS.

In some embodiments, the first special field differs from the secondspecial field.

In some embodiments, the controlling the application to obtain theaccess control permission for the USB mass storage device comprises:controlling the application to perform access control for the USB massstorage device through a bulk-only transport command.

According to a third aspect of the present disclosure, a computerreadable storage medium is provided, wherein the computer readablestorage medium stores a computer program, and the computer program, whenbeing executed by a processor, implements a USB mass storage deviceaccess control method comprising: in response to detecting that a USBmass storage device is inserted into a macOS, completing matchingbetween an application and the USB mass storage device; controlling themacOS to release an access control permission for the USB mass storagedevice; and controlling the application to obtain the access controlpermission for the USB mass storage device.

In some embodiments, after the controlling the macOS to release anaccess control permission for the USB mass storage device, the methodfurther comprises: performing disconnection and USB bus reset for theUSB mass storage device.

In some embodiments, the in response to detecting that a USB massstorage device is inserted into a macOS, completing matching between anapplication and the USB mass storage device comprises: in response todetecting that a USB mass storage device is inserted into a macOS,sending, by the application, a descriptor information acquisitioncommand including a first special field to the USB mass storage device;and in response to detecting receiving descriptor information includinga second special field, completing matching between the application andthe USB mass storage device; wherein, the descriptor informationincluding a second special field refers to information returned by theUSB mass storage device after receiving the descriptor informationacquisition command including a first special field.

In some embodiments, the in response to detecting receiving descriptorinformation including a second special field, completing matchingbetween the application and the USB mass storage device comprises: inresponse to receiving, by the USB mass storage device, the descriptorinformation acquisition command including a first special field,returning, by the USB mass storage device, description information ofthe USB mass storage device to the application, wherein the descriptioninformation includes the second special field; and in response toreceiving, by the application, the descriptor information including asecond special field, completing matching between the application andthe USB mass storage device.

In some embodiments, before the controlling the macOS to release anaccess control permission for the USB mass storage device, the methodfurther comprises: by amending the second special field, indicating theUSB mass storage device as a non-USB mass storage device to the macOS.

In some embodiments, the controlling the application to obtain theaccess control permission for the USB mass storage device comprises:controlling the application to perform access control for the USB massstorage device through a bulk-only transport command.

In order to illustrate the technical solution of the present disclosure,specific embodiments are used to illustrate below.

FIG. 1 is a schematic view of an implementing flow of a USB mass storagedevice access control method provided by a first embodiment of thepresent disclosure. The USB mass storage device access control methodcan be applied in a terminal device running macOS (e.g., Apple Macintoshcomputer series). As shown in the figure, the USB mass storage deviceaccess control method can comprise the following operations.

Operation S101, when it is detected that a USB mass storage device isinserted into a macOS, completing matching between an application andthe USB mass storage device.

In this embodiment of the present disclosure, a USB mass storage devicerequiring access control can be inserted into a terminal device runningmacOS; when detecting that the USB mass storage device is inserted,matching between an application and the USB mass storage device can becompleted. In this embodiment the application can refer to a third partyapplication in the terminal device configured to access control the USBmass storage device.

Alternatively, the when it is detected that a USB mass storage device isinserted into a macOS, completing matching between an application andthe USB mass storage device comprises: when it is detected that a USBmass storage device is inserted into a macOS, making the applicationsend a descriptor information acquisition command including a specialfield to the USB mass storage device; and when descriptor informationincluding a special field is received, matching between the applicationand the USB mass storage device is completed. In this embodiment, thedescriptor information including a special field refers to informationreturned by the USB mass storage device after receiving the descriptorinformation acquisition command including a special field.

In this embodiment of the present disclosure, when it is detected that aUSB mass storage device is inserted into a macOS, the application can becontrolled to send a descriptor information acquisition command (thatis, a get descriptor command, this command is a standard USB requestcommand used to return descriptor information of the USB mass storagedevice) to the USB mass storage device. The descriptor informationacquisition command includes a special field, the USB mass storagedevice, after receiving the descriptor information acquisition commandincluding a special field, returns description information of the USBmass storage device to the application; the description informationincludes a special field, when the application receives the descriptorinformation including a special field, matching between the applicationand the USB mass storage device is completed. In this embodiment, thespecial field in the descriptor information can indicate the USB massstorage device as a non-USB mass storage device to the macOS. Sinceaccess control permission for the USB mass storage device inserted inthe macOS is locked by the macOS, if the USB mass storage device is“amended into a non-USB mass storage device” through the special field,in other words, if the USB mass storage device is indicated as a non-USBmass storage device to the mac OS by amending the special field in thedescriptor information, it is possible to control the macOS not to lockaccess control permission for the USB mass storage device.

It should be noted that the special field in the descriptor informationacquisition command and the special field in the descriptor informationare different fields. In order to distinguish the two special fields, itis possible to define the special field in the descriptor informationacquisition command as a first special field, and define the specialfield in the descriptor information as a second special field, which isnot limited herein.

Exemplarily, a descriptor information acquisition command and descriptorinformation in the prior art are respectively as follows.

Descriptor information acquisition command: 80 06 00 01 00 00 12 00

Descriptor information: 12 01 00 02 00 00 00 40 44 86 05 80 00 01 01 0200 01

A descriptor information acquisition command (i.e., the descriptorinformation acquisition command including a special field) anddescriptor information (i.e., the descriptor information including aspecial field) in this embodiment of the present disclosure are asfollows.

Descriptor information acquisition command including a special field: 8006 00 01 5A 5A 12 00

Descriptor information including a special field: 12 01 00 02 00 00 0004 44 86 05 80 00 01 FF 02 00 01

In this embodiment, 5A 5A is a special field of manufacturerinformation, and can be defines as non-zero according to requirements.The special field in the descriptor information is the fifteenth byte,which is amended into FF, and can indicate a device returning thedescriptor information as a non-USB mass storage device, that is, it ispossible to “amend the USB mass storage device into a non-USB massstorage device through the special field”, in other words, indicate theUSB mass storage device as a non-USB mass storage device to the mac OSby amending the special field. Other bytes (bytes except the fifteenthbyte) in the descriptor information can be defined as manufactureridentification information according to requirements.

Operation S102, controlling the macOS to release an access controlpermission for the USB mass storage device.

In this embodiment of the present disclosure, after completing matchingbetween the application and the USB mass storage device, it is realizedthat “the USB mass storage device is amended into a non-USB mass storagedevice”, in other words, the USB mass storage device is indicated as anon-USB mass storage device to the macOS. At this time, it is possibleto control the macOS to release access control permission for the USBmass storage device, that is, control the macOS not to lock the accesscontrol permission for the USB mass storage device. In this embodiment,the access control permission for the USB mass storage device can referto permissions of accessing and controlling the USB mass storage device,for example, permissions of performing operations, such as fingerprintrecording, amending, deleting, and so on, on a fingerprint U-disk.

Operation S103, controlling the application to obtain the access controlpermission for the USB mass storage device.

In this embodiment of the present disclosure, after the macOS releasesthe access control permission for the USB mass storage device, theapplication can obtain the access control permission for the USB massstorage device, so as to achieve performing access control for the USBmass storage device on the macOS.

Alternatively, the controlling the application to obtain the accesscontrol permission for the USB mass storage device comprises: theapplication is controlled to perform access control for the USB massstorage device through a bulk-only transport command.

In this embodiment of the present disclosure, in order to implementaccess control for the USB mass storage device, the application canperform access control for the USB mass storage device throughcustomized bulk-only transport commands. In this embodiment, buck-onlytransport is a kind of block storage class protocol made by USB organizeaiming at USB mass storage device, this protocol transmit data,commands, states, and so on using bulk endpoints.

In this embodiment of the present disclosure, by controlling the macOSto release an access control permission for the USB mass storage device,and enabling the application to obtain the access control permission forthe USB mass storage device, the application can thus be controlled toimplement access control for the USB mass storage device on the macOS,while it is not required to first perform access control in a Windowssystem, so that access control efficiency for the USB mass storagedevice is improved.

FIG. 2 is a schematic view of an implementing flow of a USB mass storagedevice access control method provided by a second embodiment of thepresent disclosure. The USB mass storage device access control methodcan be applied in a terminal device running macOS (e.g., Apple Macintoshcomputer series). As shown in the figure, the USB mass storage deviceaccess control method can comprise the following operations.

Operation S201, when it is detected that a USB mass storage device isinserted into a macOS, completing matching between an application andthe USB mass storage device.

This operation is identical to the operation S101, and can specificallyrefer to the relative description of the operation S101, which is notrepeated here.

Operation 202, controlling the macOS to release an access controlpermission for the USB mass storage device.

This operation is identical to the operation S102, and can specificallyrefer to the relative description of the operation S102, which is notrepeated here.

Operation S203, performing disconnection and USB bus reset for the USBmass storage device.

In this embodiment of the present disclosure, after the macOS releasesthe access control permission for the USB mass storage device, it isunable to perform access control for the USB mass storage device. Inorder to realize access control for the USB mass storage device, at thistime, the terminal device can perform soft disconnection and USB busreset for the USB mass storage device, so as to obtain the descriptorinformation of the USB mass storage device by re-enumeration, that is,re-identify the USB mass storage device and establish a correspondingdata link channel.

Operation S204, controlling the application to obtain the access controlpermission for the USB mass storage device.

This operation is identical to the operation S103, and can specificallyrefer to the relative description of the operation S103, which is notrepeated here.

This embodiment of the present disclosure adds “performing disconnectionand USB bus reset for the USB mass storage device” on the basis of thefirst embodiment, thus it can be ensured that after the macOS releasesthe access control permission for the USB mass storage device, the USBmass storage device is re-identified, and the application is controlledto obtain the access control permission for the USB mass storage device.

FIG. 3 is a schematic view of a USB mass storage device access controldevice provided by a third embodiment of the present disclosure. Forease of illustration, only parts relating to this embodiment of thepresent disclosure are shown.

The access control device comprises: a matching module 31 configured to:when it is detected that a USB mass storage device is inserted into amacOS, complete matching between an application and the USB mass storagedevice; a first control module 32 configured to control the macOS torelease an access control permission for the USB mass storage device;and a second control module 33 configured to control the application toobtain the access control permission for the USB mass storage device.

Alternatively, the access control device further comprises: a processingmodule 34 configured to perform disconnection and USB bus reset for theUSB mass storage device.

Alternatively, the matching module 31 comprises a command sending unitconfigured to: when it is detected that a USB mass storage device isinserted into a macOS, make the application send a descriptorinformation acquisition command including a special field to the USBmass storage device; and a matching unit configured to: when descriptorinformation including a special field is received, complete matchingbetween the application and the USB mass storage device; wherein, thedescriptor information including a special field refers to informationreturned by the USB mass storage device after receiving the descriptorinformation acquisition command including a special field.

Alternatively, the second control module 33 is specifically configuredto: control the application to perform access control for the USB massstorage device through bulk-only transport commands.

The access control device provided by this embodiment of the presentdisclosure can be applied in the methods of the aforesaid firstembodiment and second embodiment. The details can refer to thedescription of the methods of the aforesaid first embodiment and secondembodiment, and are not repeated here.

FIG. 4 is a schematic view of a terminal device provided by a fourthembodiment of the present disclosure. As shown in FIG. 4 , the terminaldevice 4 of this embodiment comprises: a processor 40, a memory 41, anda computer program 42 stored in the memory 41 and being executable inthe processor 40. The processor 40, when executing the computer program42, implements the operations in the aforesaid embodiments of the USBmass storage device access control methods, such as the operations S101to S103 shown in FIG. 1 . Alternatively, the processor 40, whenexecuting the computer program 42, implements the functions of themodules/units in the embodiment of the device, such as the functions ofthe modules 31-34 shown in FIG. 3 .

Exemplarily, the computer program 42 can be divided into one or morenodules/units, the one or more modules/units are stored in the memory41, and are executed by the processor 40 to complete the presentdisclosure. The one or more modules/units can be a series of computerprogram instruction segments being capable of completing certainfunctions, these instruction segments are configured to describe anexecuting process of the computer program 42 in the terminal device 4.For example, the computer program 42 can be divided into a matchingmodule, a first control module, a second control module, and aprocessing module, and specific functions of these modules are asfollows.

The matching module is configured to: when it is detected that a USBmass storage device is inserted into a macOS, complete matching betweenan application and the USB mass storage device;

The first control module is configured to control the macOS to releasean access control permission for the USB mass storage device.

The second control module is configured to control the application toobtain the access control permission for the USB mass storage device.

Alternatively, the processing module is configured to performdisconnection and USB bus reset for the USB mass storage device.

Alternatively, the matching module comprises: a command sending unitconfigured to: when it is detected that a USB mass storage device isinserted into a macOS, make the application send a descriptorinformation acquisition command including a special field to the USBmass storage device; and a matching unit configured to: when descriptorinformation including a special field is received, complete matchingbetween the application and the USB mass storage device; wherein, thedescriptor information including a special field refers to informationreturned by the USB mass storage device after receiving the descriptorinformation acquisition command including a special field.

Alternatively, the second control module is specifically configured to:control the application to perform access control for the USB massstorage device through bulk-only transport commands.

The terminal device 4 can be computing device such as a desktopcomputer, a notebook computer, a personal digital assistant, a cloudserver, and so on. The terminal device can comprise, but is not limitedto, the processor 40 and the memory 41. One of ordinary skill in the artcan understand that FIG. 4 is only an example of the terminal device 4and does not form any limitation to the terminal device 4. The terminaldevice 4 can comprise more or less parts than shown in the figures, orcombine some parts, or comprise different parts, for example, theterminal device can further comprise an input/output device, a networkaccess device, a bus, etc.

It should be understood that in the embodiments of the presentdisclosure, the processor 40 can be a central processing unit (CPU); theprocessor can also be other universal processors, digital signalprocessors (DSP), application specific integrated circuits (ASIC),field-programmable gate arrays (FPGA), or other programmable logicdevices, discrete gates or transistor logic devices, discrete hardwarecomponents, and so on. The universal processor can be a microprocessor,or the processor can also be any conventional processor, etc.

The processor 40 can be a central processing unit (CPU), and can also beother universal processors, digital signal processors (DSP), applicationspecific integrated circuits (ASIC), field-programmable gate arrays(FPGA), or other programmable logic devices, discrete gates ortransistor logic devices, discrete hardware components, and so on. Theuniversal processor can be a microprocessor, or the processor can alsobe any conventional processor, etc.

The memory 41 can be an internal storage unit of the terminal device 4,for example, a hard disk or a memory module of the terminal device. Thememory 41 can also be an external storage device for the terminal device4, for example, a plug-in hard disk, a smart media card (SMC), an SDcard, a flash card, or the like equipped for the terminal device 4.Furthermore, the memory 41 can also include not only an internal storageunit of the terminal device 4 but also an external storage device. Thememory 41 is used to store the computer program and other programs anddata required by the terminal device. The memory 41 can also be used totemporarily store data that has been output or will be output.

Those skilled in the art can clearly understand that only the divisionof the above-mentioned functional units and modules is illustrated as anexample for convenience and conciseness of the description. In practicalapplications, according to requirements, the above-mentioned functionscan be allocated to different functional units and modules to complete.That is, the internal structure of the device is divided into differentfunctional units or modules to complete all or some of the functionsdescribed above. The functional units and modules in the embodiments canbe integrated into one processing unit, or each unit can physicallyexist alone, or two or more units can be integrated into one unit. Theabove-mentioned integrated units can be implemented in the form ofhardware, and can also be implemented in the form of software functionalunits. In addition, specific names of the functional units and modulesare only intended to facilitate distinguishing each other, while are notintended to limit the protection scope of the present application. Forspecific working processes of the units and modules in the foregoingsystem, reference may be made to the corresponding processes in theforegoing method embodiments, which are not repeated here.

In the above-mentioned embodiments, the description of each embodimenthas its own emphasis. For parts that are not described in detail orrecorded in a certain embodiment, reference may be made to relateddescriptions of other embodiments.

One of ordinary skill in the art can be aware that the units andalgorithm steps of the examples described in combination with theembodiments disclosed herein can be implemented by electronic hardwareor a combination of computer software and electronic hardware. Whetherthese functions are executed by hardware or software depends on thespecific application and design constraint conditions of the technicalsolution. Professional technicians can use different methods for eachspecific application to implement the described functions, but suchimplementation should not be considered as going beyond the scope of thepresent disclosure.

In the embodiments provided by the present disclosure, it should beunderstood that the disclosed devices and methods may be implemented inother ways. For example, the device embodiments described above aremerely illustrative. For example, the division of the modules or unitsis only a logical function division. In actual implementation, there maybe other division methods, for example, multiple units or components maybe combined or may be integrated into another system, or some featurescan be ignored or not implemented. In addition, the displayed ordiscussed mutual coupling, or direct coupling or communicationconnection, may be indirect coupling or communication connection throughsome interfaces, devices or units, and may be in electrical, mechanicalor other forms.

The units described as separate components may be or may not bephysically separated, and the components displayed as units may be ormay not be physical units, that is, they may be located in one place, ormay also be distributed on multiple network units. Some or all of theunits may be selected according to actual requirements to achieve theobjectives of the solutions of the embodiments.

In addition, the functional units in the various embodiments of thepresent disclosure may be integrated into one processing unit, or eachunit may physically exist alone, or two or more units may be integratedinto one unit. The above-mentioned integrated unit can be implemented inthe form of hardware, and can also be implemented in the form ofsoftware functional units.

If the integrated modules/units are implemented in the form of softwarefunctional units and sold or used as independent products, they can bestored in a computer readable storage medium. Based on suchunderstanding, all or some of the processes of the methods in theabove-mentioned embodiments implemented by the present disclosure canalso be completed by instructing relevant hardware through a computerprogram. The computer program can be stored in a computer-readablestorage medium. When the computer program is executed by a processor,the steps of the foregoing method embodiments can be implemented.Wherein, the computer program includes computer program codes, and thecomputer program codes may be in the form of source codes, object codes,executable files, or some intermediate forms, etc. The computer readablemedium may include: any entity or device capable of carrying thecomputer program codes, recording mediums, U-disks, mobile hard disks,magnetic disks, optical disks, computer memories, read-only memories(ROM, Read-Only Memory), random access memories (RAM, Random AccessMemory), electrical carrier signals, telecommunications signals,software distribution media, and so on. It should be noted that thecontent contained in the computer readable medium can be appropriatelyadded or deleted in accordance with the requirements of the legislationand patent practice in a jurisdiction. For example, in somejurisdictions, according to the legislation and patent practice, thecomputer readable medium does not include electrical carrier signals andtelecommunication signals.

The above-mentioned embodiments are only intended to illustrate but notto limit the technical solutions of the present disclosure. Although thepresent disclosure has been described in detail with reference to theforegoing embodiments, those of ordinary skill in the art shouldunderstand that: the technical solutions recorded in the foregoingembodiments can still be modified, or some of the technical featuresthereof can be equivalently replaced; these modifications orreplacements do not cause the essence of corresponding technicalsolutions to deviate from the spirit and scopes of the technicalsolutions of the embodiments of the present disclosure, and should beall included in the protection scope of the present disclosure.

The above are implementation manners of embodiments of the presentdisclosure. It should be noted that for one of ordinary skill in theart, various improvements and embellishments can also be made withoutdeparting from the principle of embodiments of the present disclosure,and these improvements and embellishments are also considered as theprotection scope of the present disclosure.

What is claimed is:
 1. A USB mass storage device access control method,comprising: in response to detecting that a USB mass storage device isinserted into a macOS, completing matching between an application andthe USB mass storage device; controlling the macOS to release an accesscontrol permission for the USB mass storage device; and controlling theapplication to obtain the access control permission for the USB massstorage device; wherein the in response to detecting that a USB massstorage device is inserted into a macOS, completing matching between theapplication and the USB mass storage device comprises: in response todetecting that the USB mass storage device is inserted into the macOS,sending, by the application, a descriptor information acquisitioncommand including a first special field to the USB mass storage device;in response to detecting receiving descriptor information including asecond special field, completing matching between the application andthe USB mass storage device; wherein, the descriptor informationincluding a second special field refers to information returned by theUSB mass storage device after receiving the descriptor informationacquisition command including a first special field; and before thecontrolling the macOS to release the access control permission for theUSB mass storage device, the method further comprises: amending thesecond special field, indicating the USB mass storage device as anon-USB mass storage device to the macOS.
 2. The method according toclaim 1, wherein, after the controlling the macOS to release an accesscontrol permission for the USB mass storage device, the method furthercomprises: performing disconnection and USB bus reset for the USB massstorage device.
 3. The method according to claim 1, wherein, the inresponse to detecting receiving descriptor information including asecond special field, completing matching between the application andthe USB mass storage device comprises: in response to receiving, by theUSB mass storage device, the descriptor information acquisition commandincluding a first special field, returning, by the USB mass storagedevice, description information of the USB mass storage device to theapplication, wherein the description information includes the secondspecial field; and in response to receiving, by the application, thedescriptor information including a second special field, completingmatching between the application and the USB mass storage device.
 4. Themethod according to claim 1, wherein the first special field differsfrom the second special field.
 5. The method according to claim 1,wherein, the controlling the application to obtain the access controlpermission for the USB mass storage device comprises: controlling theapplication to perform access control for the USB mass storage devicethrough a bulk-only transport command.
 6. A terminal device comprising amemory and a processor coupled with the memory, wherein the memory isconfigured to store a computer program executable by the processor, andthe processor is configured to execute the computer program to implementa USB mass storage device access control method comprising: in responseto detecting that a USB mass storage device is inserted into a macOS,completing matching between an application and the USB mass storagedevice; controlling the macOS to release an access control permissionfor the USB mass storage device; and controlling the application toobtain the access control permission for the USB mass storage device;wherein the in response to detecting that a USB mass storage device isinserted into a macOS, completing matching between the application andthe USB mass storage device comprises: in response to detecting that theUSB mass storage device is inserted into the macOS, sending, by theapplication, a descriptor information acquisition command including afirst special field to the USB mass storage device; in response todetecting receiving descriptor information including a second specialfield, completing matching between the application and the USB massstorage device; wherein, the descriptor information including a secondspecial field refers to information returned by the USB mass storagedevice after receiving the descriptor information acquisition commandincluding a first special field; and before the controlling the macOS torelease the access control permission for the USB mass storage device,the method further comprises: amending the second special field,indicating the USB mass storage device as a non-USB mass storage deviceto the macOS.
 7. The terminal device according to claim 6, wherein, thein response to detecting receiving descriptor information including asecond special field, completing matching between the application andthe USB mass storage device comprises: in response to receiving, by theUSB mass storage device, the descriptor information acquisition commandincluding a first special field, returning, by the USB mass storagedevice, description information of the USB mass storage device to theapplication, wherein the description information includes the secondspecial field; and in response to receiving, by the application, thedescriptor information including a second special field, completingmatching between the application and the USB mass storage device.
 8. Theterminal device according to claim 7, wherein the first special fielddiffers from the second special field.
 9. The terminal device accordingto claim 6, wherein, the controlling the application to obtain theaccess control permission for the USB mass storage device comprises:controlling the application to perform access control for the USB massstorage device through a bulk-only transport command.
 10. Anon-transitory computer readable storage medium, wherein thenon-transitory computer readable storage medium stores a computerprogram, and the computer program, when executed by a processor,implements a USB mass storage device access control method comprising:in response to detecting that a USB mass storage device is inserted intoa macOS, completing matching between an application and the USB massstorage device; controlling the macOS to release an access controlpermission for the USB mass storage device; and controlling theapplication to obtain the access control permission for the USB massstorage device; wherein the in response to detecting that a USB massstorage device is inserted into a macOS, completing matching between theapplication and the USB mass storage device comprises: in response todetecting that the USB mass storage device is inserted into the macOS,sending, by the application, a descriptor information acquisitioncommand including a first special field to the USB mass storage device;in response to detecting receiving descriptor information including asecond special field, completing matching between the application andthe USB mass storage device; wherein, the descriptor informationincluding a second special field refers to information returned by theUSB mass storage device after receiving the descriptor informationacquisition command including a first special field; and before thecontrolling the macOS to release the access control permission for theUSB mass storage device, the method further comprises: amending thesecond special field, indicating the USB mass storage device as anon-USB mass storage device to the macOS.
 11. The non-transitorycomputer readable storage medium according to claim 10, wherein, afterthe controlling the macOS to release an access control permission forthe USB mass storage device, the method further comprises: performingdisconnection and USB bus reset for the USB mass storage device.
 12. Thenon-transitory computer readable storage medium according to claim 10,wherein, the in response to detecting receiving descriptor informationincluding a second special field, completing matching between theapplication and the USB mass storage device comprises: in response toreceiving, by the USB mass storage device, the descriptor informationacquisition command including a first special field, returning, by theUSB mass storage device, description information of the USB mass storagedevice to the application, wherein the description information includesthe second special field; and in response to receiving, by theapplication, the descriptor information including a second specialfield, completing matching between the application and the USB massstorage device.
 13. The non-transitory computer readable storage mediumaccording to claim 10, wherein the first special field differs from thesecond special field.
 14. The non-transitory computer readable storagemedium according to claim 10, wherein, the controlling the applicationto obtain the access control permission for the USB mass storage devicecomprises: controlling the application to perform access control for theUSB mass storage device through a bulk-only transport command.